#!/bin/bash
set -e

case "$1" in
    configure)
        # 设置权限
        chmod +x /usr/share/wifimanager/wifimanager.py
        chmod +x /usr/bin/wifimanager
        
        # 更新桌面数据库
        if [ -x /usr/bin/update-desktop-database ]; then
            update-desktop-database /usr/share/applications/ > /dev/null 2>&1 || true
        fi
        
        # 如果有图标，更新图标缓存
        if [ -x /usr/bin/gtk-update-icon-cache ]; then
            gtk-update-icon-cache -f -t /usr/share/icons/hicolor > /dev/null 2>&1 || true
        fi
    ;;
esac

exit 0